Examples of different types of plots and how to make them.

Built with R 3.6.0 on April 28 2019


Setting up

The first argument in splot is a formula, which specifies the different parts of the plot:

splot(y ~ x * by * bet_1 * bet_2 + cov_1 + cov_2 + cov_n)

Each position in the formula has a specific name and role:

y and x are displayed on the y and x axes.

by splits data within each plot frame; its levels are shown in the legend.

bets split the data between plot frames, with bet[1] breaking out across rows, and bet[2] across columns.

covs are added as covariates in the regression models, which adjust the prediction line for scatter plots, or summaries for bar or line plots.

Any of these can also be entered as named arguments:

splot(y = y, x = x, by = by, between = list(bet_1, bet_2), cov = list(cov_1, cov_2, cov_n))

Line and bar plots